// user.ts
// const util = require('../../utils/util.js')
// import { formatTime } from '../../utils/util'

Component({
  data: {
   list4:<any>[],
   list12:<any>[],
  },
  methods:{
    adLoad() {
      console.log('Banner 广告加载成功')
    },
    adError(err:any) {
      console.error('Banner 广告加载失败', err)
    },
    adClose() {
      console.log('Banner 广告关闭')
    },
    onLoad(){
      this.getList();
    },
    getList() {
      let _th = this;
      let app = getApp();
      console.log(Object.keys(app.globalData.detail));
      let totalList = Object.keys(app.globalData.detail)
      let totalLength = totalList.length;
      let firstList = <any>[];
      let secondList = <any>[];
      for (let index = 0; index < totalLength; index++) {
        if(index<4){
          firstList.push(totalList[index])
        }else{
          secondList.push(totalList[index])
        }
      }
      _th.setData({
        list4:firstList,
        list12:secondList,
      });
    },
    gotoAnalyze(event:any){
      const title = event.currentTarget.dataset.title;
      wx.navigateTo({
        url: '/pages/browse/browse?title='+title,
      })
    }
   
  },
  lifetimes: {
    attached() {
    }
  },
})
